﻿///==========================================================================
/// @file: About.cs
/// @description:
///
/// Copyright © 2013, Simnix Software
/// Author: Simon Nixon
/// $Id$
/// $URL$
///==========================================================================
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Reflection;
using System.Diagnostics;
using System.Resources;

namespace OFC
{
    public partial class frmAbout : Form
    {
        public frmAbout()
        {
            InitializeComponent();
        }

        private void frmAbout_Load(object sender, EventArgs e)
        {
            // Load the assembly data into the respective containers
            lblVersion.Text = AssemblyVersion;
            lblCopyright.Text = AssemblyCopyright;
            lblCompany.Text = AssemblyCompany;
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            // Load the project webpage
            System.Diagnostics.Process.Start("http://ofc.codeplex.com/");
        }
        
        public string AssemblyVersion
        {
            get
            {
                // Get the version attribute
                return Assembly.GetExecutingAssembly().GetName().Version.ToString();
            }
        }
        
        public string AssemblyCopyright
        {
            get
            {
                // Get all Copyright attributes on this assembly
                object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
                // If there aren't any Copyright attributes, return an empty string
                if (attributes.Length == 0)
                    return "";
                // If there is a Copyright attribute, return its value
                return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
            }
        }
        
        public string AssemblyCompany
        {
            get
            {
                // Get all Company attributes on this assembly
                object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
                // If there aren't any Company attributes, return an empty string
                if (attributes.Length == 0)
                    return "";
                // If there is a Company attribute, return its value
                return ((AssemblyCompanyAttribute)attributes[0]).Company;
            }
        }
    }
}
